<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            height: 3000px;
        }
        .container{
            width: 200px;
            height: 100px;
            border: 1px solid #000;
            margin-top: 200px;

            /* 几个特殊属性非none时，按祖先元素定位 */
            /* transform: translateX(100px);   */
        }
        .box{
            width: 100px;
            height: 100px;
            background-color: red;
             position: fixed;  /* 固定位置 */
             top: 100px;
             right: 100px;

            /*  */
        }
    </style>
</head>
<body>
    <div class="container">
    <div class="box"></div>
    </div>
</body>
</html>